#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''=================================================
@Project -> File   ：FastRiteApi -> fee
@IDE    ：PyCharm
@Author ：Json
@Date   ：2025/3/20 14:59
@Desc   ：
=================================================='''
from xlwms_api.base.client import Client
from xlwms_api.base.helpers import sp_endpoint
from xlwms_api.utils.load_all_pages import fetch_all_pages_with_delay


class Fee(Client):

    @sp_endpoint(f'/cost/pageFundsFlow')
    def page_funds_flow(self, **kwargs):
        """
        分页查询业务流水
        """
        return self._request(kwargs.pop('path'), data={**kwargs})

    @fetch_all_pages_with_delay(delay=1.5)
    def all_page(self, **kwargs):
        return self.page_funds_flow(**kwargs)

    @sp_endpoint(f'/fee/trialFreight')
    def trial_freight(self, **kwargs):
        """
        运费试算
        """
        return self._request(kwargs.pop('path'), data={**kwargs})

    @sp_endpoint(f'/cost/costDetail')
    def cost_detail(self, **kwargs):
        """
        费用详情
        """
        return self._request(kwargs.pop('path'), data={**kwargs})